package com.breaking.second.application;


import android.app.Application;

import com.alibaba.fastjson2.JSON;
import com.breaking.second.entity.UserLoginEntity;
import com.breaking.second.utils.SecurePreferencesUtil;

import lombok.Getter;
import lombok.Setter;

public class EscortApplication extends Application {
    @Getter
    @Setter
    private static EscortApplication escortApplication;

    @Getter
    @Setter
    private static UserLoginEntity userLoginEntity;

    @Override
    public void onCreate() {
        super.onCreate();
        EscortApplication.setEscortApplication(this);
        SecurePreferencesUtil securePreferencesUtil = new SecurePreferencesUtil(UserLoginEntity.class.getName());
        String data = securePreferencesUtil.getDecryptedString(this, "data", null);
        if (data == null) return;
        EscortApplication.setUserLoginEntity(JSON.to(UserLoginEntity.class, data));
    }
}